package com.touchyourheart.model.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "hand_made")
public class HandMade implements Serializable {

  private static final long serialVersionUID = -3182074162695202535L;

  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private long id;

  @Column(name = "title", nullable = false, length = 64)
  private String title;

  @Column(name = "desp", nullable = false)
  private String desp;

  @Column(name = "video_link", length = 128)
  private String videoLink;

  @Column(name = "tooltip", length = 1024)
  private String tooltip;

  @Column(name = "like_amount", length = 8)
  private int likeAmount;

  @Column(name = "collect_amount", length = 8)
  private int collectAmount;

  @Column(name = "create_time", nullable = false)
  @Temporal(TemporalType.TIMESTAMP)
  private Date createTime;

  @ManyToOne
  @JoinColumn(name = "user_id_fk", foreignKey = @ForeignKey(name = "hm_user_id_fk"))
  private User user;

  @ManyToOne
  @JoinColumn(name = "category_child_id_fk", foreignKey = @ForeignKey(name = "hm_category_child_id_fk"))
  private CategoryChild categoryChild;

  @OneToMany(mappedBy = "handMade", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
  private List<HandMadeMethod> handMadeInfoList;

  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }

  public String getTitle() {
    return title;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getDesp() {
    return desp;
  }

  public void setDesp(String desp) {
    this.desp = desp;
  }

  public String getVideoLink() {
    return videoLink;
  }

  public void setVideoLink(String videoLink) {
    this.videoLink = videoLink;
  }

  public String getTooltip() {
    return tooltip;
  }

  public void setTooltip(String tooltip) {
    this.tooltip = tooltip;
  }

  public int getLikeAmount() {
    return likeAmount;
  }

  public void setLikeAmount(int likeAmount) {
    this.likeAmount = likeAmount;
  }

  public int getCollectAmount() {
    return collectAmount;
  }

  public void setCollectAmount(int collectAmount) {
    this.collectAmount = collectAmount;
  }

  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  public User getUser() {
    return user;
  }

  public void setUser(User user) {
    this.user = user;
  }


  public CategoryChild getCategoryChild() {
    return categoryChild;
  }

  public void setCategoryChild(CategoryChild categoryChild) {
    this.categoryChild = categoryChild;
  }

  public List<HandMadeMethod> getHandMadeInfoList() {
    return handMadeInfoList;
  }

  public void setHandMadeInfoList(List<HandMadeMethod> handMadeInfoList) {
    this.handMadeInfoList = handMadeInfoList;
  }

}
